.class public Lcom/estrongs/fs/impl/usb/d;
.super Ljava/io/OutputStream;
.source "UsbFileOutputStream.java"


# instance fields
.field private a:Les/e50;

.field private b:J

.field private c:J


# direct methods
.method public constructor <init>(Les/e50;J)V
    .locals 2

    .line 1
    invoke-direct {p0}, Ljava/io/OutputStream;-><init>()V

    const/4 v0, 0x0

    .line 2
    iput-object v0, p0, Lcom/estrongs/fs/impl/usb/d;->a:Les/e50;

    const-wide/16 v0, 0x0

    .line 3
    iput-wide v0, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    .line 4
    iput-wide v0, p0, Lcom/estrongs/fs/impl/usb/d;->c:J

    .line 5
    iput-object p1, p0, Lcom/estrongs/fs/impl/usb/d;->a:Les/e50;

    .line 6
    iput-wide p2, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    .line 7
    iput-wide p2, p0, Lcom/estrongs/fs/impl/usb/d;->c:J

    return-void
.end method


# virtual methods
.method public close()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lcom/estrongs/fs/impl/usb/d;->a:Les/e50;

    if-eqz v0, :cond_0

    .line 2
    invoke-interface {v0}, Les/e50;->close()V

    :cond_0
    return-void
.end method

.method public write(I)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x1

    new-array v1, v0, [B

    int-to-byte p1, p1

    const/4 v2, 0x0

    aput-byte p1, v1, v2

    .line 9
    invoke-virtual {p0, v1, v2, v0}, Lcom/estrongs/fs/impl/usb/d;->write([BII)V

    return-void
.end method

.method public write([BII)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    :try_start_0
    invoke-static {p1, p2, p3}, Ljava/nio/ByteBuffer;->wrap([BII)Ljava/nio/ByteBuffer;

    move-result-object p1

    .line 2
    iget-object p2, p0, Lcom/estrongs/fs/impl/usb/d;->a:Les/e50;

    iget-wide v0, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    invoke-interface {p2, v0, v1, p1}, Les/e50;->b(JLjava/nio/ByteBuffer;)V

    .line 3
    iget-wide p1, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    int-to-long v0, p3

    add-long/2addr p1, v0

    iput-wide p1, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    .line 4
    iget-wide v0, p0, Lcom/estrongs/fs/impl/usb/d;->c:J

    sub-long/2addr p1, v0

    const-wide/32 v0, 0x500000

    cmp-long p3, p1, v0

    if-lez p3, :cond_0

    .line 5
    iget-object p1, p0, Lcom/estrongs/fs/impl/usb/d;->a:Les/e50;

    invoke-interface {p1}, Les/e50;->flush()V

    .line 6
    iget-wide p1, p0, Lcom/estrongs/fs/impl/usb/d;->b:J

    iput-wide p1, p0, Lcom/estrongs/fs/impl/usb/d;->c:J
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    return-void

    :catch_0
    move-exception p1

    .line 7
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    .line 8
    new-instance p1, Ljava/io/IOException;

    invoke-direct {p1}, Ljava/io/IOException;-><init>()V

    throw p1
.end method
